CCCPaste

Como Crear Breadcrumbs en WordPress con PHP

// Llama la función PHP en tu código HTML


// Función PHP
function breadcrumb_nc() {
	global $post;
	if ( ! is_home() ) {
		echo 'Home » ';
		if ( is_category() || is_single() ) {
			the_category( ' » ' );
			if ( is_single() ) {
				echo ' » ';
				the_title();
			}
		} elseif ( is_page() ) {
			if ( $post->post_parent ) {
				$anc   = get_post_ancestors( $post->ID );
				$title = get_the_title();
				foreach ( $anc as $ancestor ) {
					$output = '' . get_the_title( $ancestor ) . ' » ';
				}
				echo $output;
				echo $title;
			} else {
				echo ' ' . get_the_title() . '';
			}
		}
	}
}